package String;

import java.util.Arrays;

public class SplitDemo {
    public static void main(String[] args) {
        String line = "abc123def456ghi";
        String[] data = line.split("[0-9]+");
        System.out.println(Arrays.toString(data));

        line  = "123.456.789";
        data = line.split("\\.");
        System.out.println(Arrays.toString(data));
        //最开始就是可拆分项，那么数组第一个要素是空字符串
        //如果连续两个以上可拆分项，那么中间也拆分出空字符串
        line = ".123....456..789.......";
        data = line.split("\\.");
        System.out.println(Arrays.toString(data));
        System.out.println(data.length);
    }
}
